package com.hinnotek.amoeba.adapters.old

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.bean.old.ContractBean

class PurchaseDetailAdapter(data: MutableList<ContractBean>?) : BaseMultiItemQuickAdapter<ContractBean, BaseViewHolder>(data) {
    protected override fun convert(holder: BaseViewHolder, item: ContractBean) {
        when (item.b) {
            0 -> {
                holder.setText(R.id.tv_contract_type, item.data!!.contractTypeName)
                holder.setText(R.id.tv_contract_unit, item.data!!.signUnit)
                holder.setText(R.id.tv_contract_num, item.data!!.contractNo)
                holder.setText(R.id.tv_contract_num_sub, item.data!!.contractSelfNo)
                holder.setText(R.id.tv_contract_date, item.data!!.signDate)
                holder.setText(R.id.tv_contract_total, item.data!!.signMoney)
            }
            1 -> {
                holder.setText(
                    R.id.tv_contract_project_name,
                    item.companyContractProjects!!.projectName
                )
                holder.setText(
                    R.id.tv_contract_product_name,
                    item.companyContractProjects!!.productName
                )
                holder.setText(
                    R.id.tv_contract_product_type,
                    item.companyContractProjects!!.productTypeName
                )
                holder.setText(R.id.tv_contract_num, item.companyContractProjects!!.productNum)
                holder.setText(R.id.tv_user, item.companyContractProjects!!.customerName)
            }
        }
    }

    init {
        addItemType(0, R.layout.include_contract_detail_1)
        addItemType(1, R.layout.include_contract_detail_2)
    }
}